load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
load("//bazel:prost.bzl", "protobuf_generator")

package(default_visibility = ["//visibility:public"])

DEPENDENCIES = [
    # Keep sorted.
    "//rs/utils/rustfmt",
    "@crate_index//:prost-build",
]

MACRO_DEPENDENCIES = []

DEV_DEPENDENCIES = []

MACRO_DEV_DEPENDENCIES = []

ALIASES = {}

rust_library(
    name = "lib",
    srcs = ["src/lib.rs"],
    aliases = ALIASES,
    crate_name = "ic_registry_common_proto_generator",
    proc_macro_deps = MACRO_DEPENDENCIES,
    version = "0.9.0",
    deps = DEPENDENCIES,
)

protobuf_generator(
    name = "generator",
    srcs = ["src/main.rs"],
    manifest_dir = "rs/registry/proto/generator",
    deps = [":lib"],
)

rust_test(
    name = "generator_test",
    aliases = ALIASES,
    crate = ":lib",
    proc_macro_deps = MACRO_DEPENDENCIES + MACRO_DEV_DEPENDENCIES,
    deps = DEPENDENCIES + DEV_DEPENDENCIES,
)
